$def with (ip)

$var title: $_("[Admin Center]") $ip

<div id="contentHead">
    $:render_template("admin/menu")
    <h1><a class="plain" href="/admin/ip">$_("IP")</a> / $ip</h1>
</div>

<div id="contentBody">

$if ip in get_blocked_ips():
    <div>$:_('IP %(ip)s is <a href="/admin/block">blocked</a>.', ip=ip)</div>
$else:
    <form method="POST" id="block">
        <input type="hidden" name="action" value="block"/>
        <button type="submit" class="larger" name="submit">$_('Block %(ip)s', ip=ip)</button>
    </form>

<p>
$_("Please select the changesets to revert.")
</p>

$ limit = safeint(query_param('limit'), 100)
$ offset = safeint(query_param('offset'), 0)
$ changes = recentchanges(dict(ip=ip, limit=limit, offset=offset))

$def call_template(name, change):
    $ t = get_template("recentchanges/" + change.kind + "/" + name) or get_template("recentchanges/default/" + name)
    $:t(change)

<form method="POST" name="revert" class="olform">
<table class="changeHistory">
    <thead>
        <tr>
            <th></th>
            <th>$_("When")</th>
            <th>$_("What")</th>
            <th>$_("Who")</th>
            <th>$_("Comment")</th>
        </tr>
    </thead>
    <tbody>
    $for c in changes:
        $ reverts = recentchanges({"kind": "revert", "data": {"reverted_changesets": c.id}})
        $ revert = reverts and reverts[0]
        $if revert:
            $if revert.author:
                $ revert_author = reverts[0].author.displayname
            $else:
                $ revert_author = reverts[0].ip
        <tr>
            <td>
                $if not revert:
                    <input type="checkbox" name="changesets" value="$c.id" checked="checked"/>
            </td>
            <td class="time">$datestr(c.timestamp)</td>
            <td class="path">$:call_template("path", c)</td>
            $if c.author:
                <td class="displayname"><a rel="nofollow" href="$c.author.key">$c.author.displayname</a></td>
            $elif c.ip and c.ip != '127.0.0.1':
                $ klass = cond(c.ip in get_blocked_ips(), 'red', "")
                <td class="history"><a rel="nofollow" href="$changequery()" class="$klass" title="$_('When you see numbers here, that\'s the IP address of the anonymous editor')">$c.ip</a></td>
            $else:
                <td class="history">$c.ip</td>
            <td class="comment">
                $:call_template("comment", c)
                $if revert:
                    <b>-- <a href="$revert.url()">$_('Reverted by %(revert_author)s', revert_author=revert_author)</a></b>
            </td>
        </tr>
    </tbody>
</table>

<br/>

<div class="formElement">
    <div class="label">
        <label for="comment">$:_('Please, leave a short note about what you changed: <span class="small gray">(Optional, but very useful!)</span>')</label>
    </div>
    <div class="input">
        <input type="text" name="comment" id="comment" value="$_('Reverted spam')" style="width:900px;"/>
    </div>
</div>

<div class="formElement collapse" style="position:relative;">
    <div class="input">
        <button type="submit" class="larger" name="submit" title="$_('Submit')">$_("Submit")</button>
    </div>
</div>

</form>
</div>
